$:.unshift File.join(File.dirname(__FILE__),'..','lib')
$:.unshift File.join(File.dirname(__FILE__),'..','test')

require 'helpers'
require 'model'
require 'bigdecimal'

class CreateSampleTransactions
  def CreateSampleTransactions.execute
    m = Model.new(Dir.pwd)
    tx = []
    
    tx << Helpers.transaction_simple("2008-04-01", m["Opening Balances"], m["Checking"], BigDecimal.new("1234.56"))
    tx << Helpers.transaction_simple("2008-04-01", m["Opening Balances"], m["Savings"], BigDecimal.new("9876.54"))
    tx << Helpers.transaction_simple("2008-04-01", m["Opening Balances"], m["Cash"], BigDecimal.new("55.55"))
    tx << Helpers.transaction_simple("2008-04-01", m["Opening Balances"], m["Retirement"], BigDecimal.new("70304.18"))
    
    tx << Helpers.transaction_simple("2008-04-01", m["Opening Balances"], m["Credit Card"], BigDecimal.new("555.66"))
    tx << Helpers.transaction_simple("2008-04-01", m["Opening Balances"], m["Car Loan"], BigDecimal.new("22334.45"))
    tx << Helpers.transaction_simple("2008-04-01", m["Opening Balances"], m["Mortgage"], BigDecimal.new("111111.11"))
    
    tx << Helpers.transaction_simple("2008-04-02", m["Income"], m["Checking"], BigDecimal.new("1001.99"))
    tx << Helpers.transaction_simple("2008-04-02", m["Checking"], m["Expense"], BigDecimal.new("66.66"))
    tx << Helpers.transaction_simple("2008-04-03", m["Checking"], m["Expense"], BigDecimal.new("77.77"))
    tx << Helpers.transaction_simple("2008-04-02", m["Credit Card"], m["Expense"], BigDecimal.new("8.88"))
    tx << Helpers.transaction_simple("2008-04-04", m["Credit Card"], m["Expense"], BigDecimal.new("8.76"))
    tx << Helpers.transaction_simple("2008-04-05", m["Credit Card"], m["Expense"], BigDecimal.new("80.86"))
    tx << Helpers.transaction_simple("2008-04-06", m["Credit Card"], m["Expense"], BigDecimal.new("8.42"))
    tx << Helpers.transaction_simple("2008-04-10", m["Checking"], m["Credit Card"], BigDecimal.new("77.77"))
    tx << Helpers.transaction_simple("2008-04-15", m["Checking"], m["Car Loan"], BigDecimal.new("88.88"))
    tx << Helpers.transaction_simple("2008-04-30", m["Checking"], m["Mortgage"], BigDecimal.new("99.99"))
    tx << Helpers.transaction_simple("2008-04-09", m["Savings"], m["Checking"], BigDecimal.new("3747.00"))
    tx << Helpers.transaction_simple("2008-04-21", m["Savings"], m["Cash"], BigDecimal.new("66.66"))
    tx << Helpers.transaction_simple("2008-04-01", m["Cash"], m["Expense"], BigDecimal.new("1.23"))
    tx << Helpers.transaction_simple("2008-04-02", m["Cash"], m["Expense"], BigDecimal.new("4.56"))
    tx << Helpers.transaction_simple("2008-04-03", m["Cash"], m["Expense"], BigDecimal.new("7.89"))
    tx << Helpers.transaction_simple("2008-04-05", m["Cash"], m["Expense"], BigDecimal.new("3.21"))
    tx << Helpers.transaction_simple("2008-04-08", m["Cash"], m["Expense"], BigDecimal.new("6.54"))
    tx << Helpers.transaction_simple("2008-04-13", m["Cash"], m["Expense"], BigDecimal.new("9.87"))
    
    tx.each{|t| m.post(t) }
    
    puts m["Checking"].inspect
  end
end

CreateSampleTransactions.execute